﻿using SqlSugar;

namespace Zhaoxi.SqlSugar.Models
{
    /// <summary>
    /// 创建表中的各种索引
    /// </summary>
    [SugarIndex("index_codetable3_name", nameof(CodeFirstTable3.Name), OrderByType.Asc)] //普通索引--非聚集索引
    [SugarIndex("unique_codetable3_CreateTime", nameof(CodeFirstTable3.CreateTime), OrderByType.Desc, true)] //唯一索引 (true表示唯一索引) 
    [SugarIndex("index_codetable3_nameid", nameof(CodeFirstTable3.Name), OrderByType.Asc, nameof(CodeFirstTable1.Id), OrderByType.Desc)]   //复合普通索引
    // db是数据库名称占位符
    [SugarIndex("{db}index_codetable3_name", nameof(CodeFirstTable3.Description), OrderByType.Asc)]  //使用 {db}  进行占位符替换，小写不要有空格
    // table是表名占位符
    [SugarIndex("index_{table}_name", nameof(CodeFirstTable3.DescriptionNew), OrderByType.Asc)] //表名占位符（自动分表不需要加这个自动的）
    [SugarIndex("IndexUnituadfasf3_longx{include:name,id}", nameof(IndexUnituadfasf), OrderByType.Asc)]
    [SugarTable("CodeFirstTable3", TableDescription = "表备注")]//表添加备注
    public class CodeFirstTable3
    {
        [SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
        public int Id { get; set; }

        public string? Name { get; set; }

        [SugarColumn(ColumnDataType = "Nvarchar(255)")]//custom
        public string? Text { get; set; }

        [SugarColumn(IsNullable = true)]
        public DateTime CreateTime { get; set; }

        [SugarColumn(ColumnDataType = "Nvarchar(255)")]//custom
        public string? Description { get; set; }


        [SugarColumn(ColumnDataType = "Nvarchar(255)")]//custom
        public string? DescriptionNew { get; set; }

        [SugarColumn(ColumnDataType = "Nvarchar(255)")]//custom
        public string? IndexUnituadfasf { get; set; }
    }
}